<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #div1 {
            width: 100px;
            height: 100px;
            background: red;
            margin-bottom: 10px;
        }
        #div2 {
            width: 100px;
            height: 100px;
            background: green;
            margin-bottom: 10px;
        }
        #div3 {
            width: 300px;
            height: 300px;
            border: 5px solid black;
            margin-bottom: 10px;
        }
    </style>
</head>
<body>
    <div id="div1" draggable="true"></div>
    <div id="div2" draggable="true"></div>
    <div id="div3"></div>
    <script>
        var div1 = document.getElementById('div1');
        var div2 = document.getElementById('div2');
        var div3 = document.getElementById('div3');
        div1.addEventListener('dragstart',function(e){
            e.dataTransfer.setData('data',this.id);
        })
        div2.addEventListener('dragstart',function(e){
            e.dataTransfer.setData('data',this.id);
        })
        div3.addEventListener('dragover',function(e){
            e.preventDefault();
        })
        div3.addEventListener('drop',function(e){
            var data = e.dataTransfer.getData('data');
            div3.appendChild(document.getElementById(data));
        })
    </script>
</body>
</html>